import wsgiref.handlers
from google.appengine.ext import webapp

import logging, os

# Force Django to reload its settings.
from django.conf import settings
settings._target = None

# Must set this env var before importing any part of Django
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'

import Main

import time_converter
import time_converter.Demo
import time_converter.Converter
import time_converter.Gadget

import lucky_draw
import lucky_draw.ApplyDraw
import lucky_draw.Print

import registration
import registration.Admin
import registration.Event
import registration.CreateEvent
import registration.RegisterEvent
import registration.UpdateEvent
import registration.ExportGuestList
import registration.EventBroadcast

def main():
  application = webapp.WSGIApplication(
      [
          ('/time-converter/convert', time_converter.Converter.Converter)
        , ('/time-converter/gadget\.xml', time_converter.Gadget.Gadget)
        , ('/time-converter', time_converter.Demo.Demo)

        , ('/lucky-draw/apply', lucky_draw.ApplyDraw.ApplyDraw)
        , ('/lucky-draw/print', lucky_draw.Print.Print)

        , ('/event-registration/admin', registration.Admin.Admin)
        , ('/event-registration/event', registration.Event.Event)
        , ('/event-registration/create_event', registration.CreateEvent.CreateEvent)
        , ('/event-registration/register_event', registration.RegisterEvent.RegisterEvent)
        , ('/event-registration/update_event', registration.UpdateEvent.UpdateEvent)
        , ('/event-registration/export', registration.ExportGuestList.ExportGuestList)
        , ('/event-registration/broadcast', registration.EventBroadcast.EventBroadcast)

        , ('/', Main.Main)
      ]
    , debug=True
  )
  wsgiref.handlers.CGIHandler().run( application )
# end of main

if __name__ == "__main__":
  main()
